package com.linko.intelligent.remote.core.controller;

import com.github.pagehelper.PageInfo;
import com.linko.intelligent.base.CommonResponse;
import com.linko.intelligent.remote.core.service.IotService;
import com.linko.intelligent.remote.pojo.query.IotQuery;
import com.linko.intelligent.remote.pojo.vo.PositionReportVo;
import com.linko.intelligent.remote.pojo.vo.SpeedReportVo;
import com.linko.intelligent.remote.pojo.vo.StopReportVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.repository.query.Param;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * @Author yuan
 * @create 2024/4/14 18:30
 */
@RestController
@RequestMapping("/report")
@Api(value = "ReportController", tags = "Report")
public class ReportController {

    @Autowired
    IotService iotService;


    /***
     * iot停车报表
     * @param
     * @return
     */
    @ApiOperation("停车报表")
    @GetMapping(value = "/stopList")
    public CommonResponse<PageInfo<StopReportVo>> stopList(@Param("query") IotQuery query) {
        return new CommonResponse(CommonResponse.SUCCESS, "", iotService.countStopList(query));
    }

    /***
     * iot速度报表
     * @param
     * @return
     */
    @ApiOperation("速度报表")
    @GetMapping(value = "/speedList")
    public CommonResponse<PageInfo<SpeedReportVo>> speedList(@Param("query") IotQuery query) {
        return new CommonResponse(CommonResponse.SUCCESS, "", iotService.countSpeed(query));
    }

    /***
     * 位置列表详情
     * @param
     * @return
     */
    @ApiOperation("位置列表详情")
    @GetMapping(value = "/positionDetailList")
    public CommonResponse<PageInfo<PositionReportVo>> positionDetailList(@Param("query") IotQuery query) {
        return new CommonResponse(CommonResponse.SUCCESS, "", iotService.positionDetailList(query));
    }
}
